#
# Makefile for Minibase Projects
# CS 541, Fall 2011, Purdue University
#
# This Makefile was designed for Linux.
# For Windows (cygwin), change each : to \; in the variables below.
#

SRCPATH=src
BINPATH=bin
SOLJARS=lib/heap.jar:lib/bufmgr.jar:lib/diskmgr.jar:lib/index.jar:lib/relop.jar

JAVAC = javac -d $(BINPATH) -classpath $(BINPATH):$(SOLJARS)
JAVA  = java -classpath $(BINPATH):$(SOLJARS)

all: global parser query

parser:
	$(JAVAC) $(SRCPATH)/parser/*.java
query:
	$(JAVAC) $(SRCPATH)/query/*.java
global:
	$(JAVAC) $(SRCPATH)/global/*.java

test:
	java -classpath $(BINPATH):$(SOLJARS) global.Msql < $(SRCPATH)/tests/TestDB.sql

run:
	java -classpath $(BINPATH):$(SOLJARS) global.Msql

clean: clean_classes clean_backups clean_temps
	rm -rf *.minibase $(BINPATH)/*

clean_classes:
	\find ./bin -name \*.class -exec rm -f {} \;

clean_backups:
	\find ./bin -name \*~ -exec rm -f {} \;

clean_temps:
	\find ./bin -name \#* -exec rm -f {} \;

